package com.imooc.qrcode;

import jp.sourceforge.qrcode.QRCodeDecoder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;

/**
 * 读取二维码文件
 * Created by Administrator on 2017/8/14.
 */
public class ReadQRCode {
    public static void main(String[] args) throws Exception {
        File file= new File("D:/code/qrcode.png");

        BufferedImage bufferedImage = ImageIO.read(file);

        QRCodeDecoder codeDecoder = new QRCodeDecoder();

        String result = new String(codeDecoder.decode(new MyQRCodeImage(bufferedImage)),"gb2312");

        System.out.println(result);


    }
}
